﻿@using VirtualPress.Infrastructure.Entities.Entity;
@using VirtualPress.Infrastructure.Entities.Enum;
@{
    ViewBag.Title = "会议稿件";
    Layout = "/Areas/WorkSpace/Views/Shared/_WorkSpace.cshtml";
}
<div id="content-header">
    <h1>
        会议稿件</h1>
</div>
<div id="breadcrumb">
    <a href="/WorkSpace/member/index" class="tip-bottom"><i class="icon-home"></i>起始页</a>
    <a href="javascript:" class="current">会议稿件</a>
</div>
<div class="container-fluid">
    <div class="row-fluid">
        <div class="span12">
            <div class="alert alert-info">
                <button type="button" class="close" data-dismiss="alert">
                    &times;</button>
                <strong>注：</strong>如果您误删稿件，请联系管理员处理。
            </div>
            <div class="widget-box">
                <div class="widget-title">
                    <h5>
                        会议稿件</h5>
                </div>
                <div class="widget-content nopadding">
                    <table class="table table-bordered">
                        <thead>
                            <tr style="cursor: pointer;">
                                <th>
                                    标题
                                </th>
                                <th style="width: 20%">
                                    作者
                                </th>
                                <th style="width: 18%">
                                    会议
                                </th>
                                <th style="width: 10%">
                                    投稿时间
                                </th>
                                <th style="width: 10%">
                                    审核状态
                                </th>
                                <th style="width: 15%">
                                    操作
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            @{
                                ItemListBox<Article> data = ViewBag.Article;
                                if (data.Data != null && data.Data.Any())
                                {
                                    foreach (var item in data.Data)
                                    {
                                <tr>
                                    <td >
                                        <a href="/workspace/member/manuscriptdetail/@item.Id" target="_blank" title="@item.Title">@item.Title</a>
                                    </td>
                                    <td>
                                        @for(int i =0,len =item.ArticleAuthor.Count;i<len;i++)
                                        {
                                            @item.ArticleAuthor[i].AuthorName
                                            if(i!=len-1)
                                            {
                                                <span>、</span>
                                            }
                                        }
                                    </td>
                                    <td style="text-align: center">
                                        @item.Meeting.Name
                                    </td>
                                    <td style="text-align: center">
                                        @item.CreateTime.ToString("yyyy-MM-dd")
                                    </td>
                                    <td style="text-align: center">
                                        @item.Status.Mapping()
                                    </td>
                                    <td style="text-align: center">
                                    @if(item.IsDelete)
                                    {
                                        <i>稿件已删除</i>
                                    }
                                    else
                                    {
                                        if (item.Status == ArticleStatus.Open)
                                        {
                                            <a href="/workspace/member/manuscriptedit/@item.Id" target="_blank" class="btn btn-primary btn-mini">
                                                编辑</a>
                                        }
                                        else if (item.Status == ArticleStatus.ZhongShenXiuDing || item.Status == ArticleStatus.ZhuanShenXiuDing)
                                        {
                                            <a href="/workspace/member/manuscriptdetail/@item.Id" target="_blank" class="btn btn-primary btn-mini">
                                                修订</a>
                                        }
                                        else if(item.Status == ArticleStatus.BuJiaoFei ||item.Status == ArticleStatus.LuYong || item.Status == ArticleStatus.ZhuanShenDaiJiaoFei)
                                        {
                                             <a href="/payment/paying" target="_blank" class="btn btn-success btn-mini">
                                                缴费</a>
                                        }
                                        else
                                        {      
                                            <a href="/workspace/member/manuscriptdetail/@item.Id" target="_blank" class="btn btn-primary btn-mini">
                                                查看</a>
                                        }
                                        if (item.Status == ArticleStatus.Open || item.Status == ArticleStatus.Close)
                                        {
                                            <a href="javascript:;" onclick="cancelArticle(@item.Id)" class="btn btn-danger btn-mini">
                                                删除</a>
                                        }
                                     }
                                    </td>
                                </tr>
                                    }
                                }
                            }
                        </tbody>
                    </table>
                </div>
                @Html.Raw(data.PageItemSegment)
            </div>
        </div>
    </div>
</div>
@section tail{
    <script type="text/javascript">
        $(function () {
            $('#likmtarticle').addClass('active open');
        });
        function cancelArticle(id) {
            if (confirm('确定要删除此稿件吗？')) {
                window.location.href = "/workspace/member/cancelManuscript/" + id + "?type=@ViewBag.Type";
            }
        }
    </script>
}
